<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="../include/taglib.jsp"%>
<%@page import="java.util.*"%>
<%@ page import="com.sinodata.bsm.common.vo.*" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<title>修改资源组</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<meta http-equiv="pragma" content="no-cache" />
		<meta http-equiv="cache-control" content="no-cache" />
		<meta http-equiv="expires" content="0" />
		<%@ include file="../include/common.jsp"%>
		<%@ include file="../include/form.jsp"%>
		<script type="text/javascript">
	      
  function add(){
	  //提交
	 $.ajax({
		   type: "POST", 
		   url: "${pageContext.request.contextPath}/resource/res-group!update.action", //请求的action
		   data: $("#myform").serialize(), //传的参数
		   dataType: 'json',
		   success: function(data){ //结果
					var pWin = getTopWin(window).currentWin["res-group-update"];
					pWin.parent.location.reload();
				   getTopWin(window).closejBox("res-group-update");
			   
			   
		   }
	});
	  
	  
  }
  $(function(){
	  $.formValidator.initConfig({formid:"myform"
          ,onerror:function(msg){alert(msg)}
          ,onsuccess:function(){
        	  		add();
          			return false;
          }
          });
	  $("#name").formValidator({onshow:"请输入资源组名称",onfocus:"资源名称最大长度为40"})
			          .inputValidator({min:1,onerror:"资源组名称不能为空"})
			          .functionValidator({
			          	  fun:function(val,elem){
			          	     if(val.length>40){
			          	     	return "资源组名称长度输入有误";
			          	     }
			          	     return true;
			          	  }
			          });
	
  });
	     function closewin(){
	   		getTopWin(window).closejBox("res-group-update");
  		}
  		function setRoot(){
			var isChecked = $("#isRoot").attr("checked");
			if(isChecked){
				$("#presname").css("textDecoration","line-through");
			}else{
				$("#presname").css("textDecoration","none");
			}
		}
		</script>
	</head>
  <body class="padding-8">
    	<form action="" id="myform" name="myform" method="post">
			<input type="hidden" name="id" id="id" value="${resGroup.id }" >
    		<table class="table_eidt">
    			<tr>
	    			<td class="td_left" width="80px">父节点</td>
	    			<td class="td_right">
	    			
	    			<span id="presname">${pname }</span>
	    			
	    			</td>
    			</tr>
    			<tr>
	    			<td class="td_left"><span class="span_alert">*</span>名称</td>
	    			<td class="td_right">
	    			<input type="text" name="name" id="name" value="${resGroup.name }" class="input_text">
	    			<span id="nameTip" style="width:150px"></span></td>
    			</tr>
    			<tr>
	    			<td class="td_left">描述</td>
	    			<td class="td_right">
	    		
	    			<textarea class="input_textarea" name="descript" rows="2"  >${resGroup.descript}</textarea>
	    			</td>
    			</tr>
    		</table>
    		<div align="center" style="margin-top:9px;">
	    		<input type="submit" id="button" name="button" value="保存" class="btn-4">
	    		<input type="reset" class="btn-4">
	    		<input type="button" value="取消" onclick="closewin();" class="btn-4">
    		</div>
    	</form>
  </body>
</html>
